
export default class PrefabManager
{


    private static objs={};

    //加载预制体
    public static loadPrefabs(call)
    {

        cc.resources.loadDir("./prefab/", (err, assets : cc.Prefab[])=>{
 
           if(assets!=null)
           {
                for(let i=0;i<assets.length;i++)
                {
                    this.objs[assets[i].name]=assets[i];
                }

                call();
           }
         
        })
     
      
    
    }

    public static getPrefab(name:string):cc.Prefab
    {

        if(this.objs.hasOwnProperty(name)==false)
        {
            console.error("没有找到预制体---"+name);
        }

        return this.objs[name];
    }
}